package taskmaster.job;

public class Dependency {

	String task_tag,dependency_tag;
    public String description;
	
	public Dependency(String d, String t,String desc) {
	    this.dependency_tag = d;
	    this.task_tag = t;
        if(desc!=null)
        this.description= desc ;
        else
           this.description ="";
	  }
	
	 	public Dependency(String d, String t) {
	    this.dependency_tag = d;
	    this.task_tag = t;
         }


	  public String getDependency() {
	    return dependency_tag;
	  }

	  public String getTask() {
	    return task_tag;
	  }

	  public String toString() {
	    return "[ dependency=" + dependency_tag + ",task=" + task_tag + "]";
	  }

	  public int compareTo(Object obj) {
	    Dependency dep = (Dependency) obj;
	    int deptComp = dependency_tag.compareTo(dep.getDependency());

	    return ((deptComp == 0) ? task_tag.compareTo(dep.getTask()) : deptComp);
	  }

	  public boolean equals(Object obj) {
	    if (!(obj instanceof Dependency)) {
	      return false;
	    }
	   Dependency dep = (Dependency) obj;
	    return task_tag.equals(dep.getDependency()) && task_tag.equals(dep.getTask());
	  }
	}
	
	
	

